<?php
apf_require_controller("Abstract");
apf_require_class('Bll_Flow_Lumesse');
/**
 * lumesse 登录
 * @author dinglin
 *
 */
class Portal_Home_LumesseController extends AbstractController {

    public function handle_request() {
        //存在多
        $users = Bll_Flow_Lumesse::get_instance()->get_user_by_id($this->get_user_id());
        if($users){
            $user = $users[0];
            $lumesse_user_user = Bll_Flow_Lumesse::get_instance()->Lumesse_User()->User();
            $result = $lumesse_user_user->generateTemporaryPassword(array('userLogin'=>$user['lums_account']));//12345678
            $this->request->set_attribute('password',$result->return);
            $this->request->set_attribute('userLogin',$user['lums_account']);
            $lumesse = APF::get_instance()->get_config('lumesse','common');
            $this->request->set_attribute('AccountName',$lumesse['AccountName']);

            return "Portal_Home_Lumesse";
        }else{
            $this->response->redirect('/');
        }
    }
}